{extend name="../../admin/view/full"}

{block name='content'}
<div class="padding-25" data-select-container>
    {include file='article_content/select_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class="text-left nowrap">文章标题</th>
            <th class="text-left nowrap">文章状态</th>
            <th class="text-left nowrap">创建时间</th>
            <th class="text-left nowrap"></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class="text-left nowrap">{$vo.title|default=''}</td>
            <td class="text-left nowrap">{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">使用中</span>{/if}</td>
            <td class="text-left nowrap">{$vo.create_at|format_datetime}</td>
            <td class='text-left nowrap'>

                <a class="layui-btn layui-btn-sm layui-btn-normal" data-article="{$vo.id}">选择文章</a>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}

{block name='script'}
<script>
    $(function () {
        layui.form.render();
        $('[data-article]').on('click', function () {
            top.setAttackId(this.getAttribute('data-article') || '');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        });
        $.form.reInit($('[data-select-container]'));
    });
</script>
{/block}
